package stockblaster.client;

import stockblaster.client.facilities.Facilities;
import stockblaster.client.objectives.MoneyObjective;
import stockblaster.client.objectives.Objective;
import stockblaster.client.objectives.TimeObjective;
import stockblaster.gen.R;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;

public class CampaignSelectActivity extends Activity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.campaign_select);
	}

	@Override
	public void onBackPressed() {
		MethodHelper.switch_activity(this, SplashActivity.class, false);
	}

	public void ardoPage(View v) {
		MethodHelper.switch_activity(this, ArdoProfileActivity.class, false);
	}

	public void campaignPage(View v) {
		CurrentUser.createNewUser("Mary Canny", 8000.00);
		MainPageActivity.first_time = true;
		initCampaign();
		Facilities.init();
		MethodHelper.switch_activity(this, MainPageActivity.class, false);
	}

	public void helpMenu(View v) {
		CurrentUser
				.setFromClass(CampaignSelectActivity.class, CurrentUser.HELP);
		MethodHelper.switch_activity(this, HelpActivity.class, false);
	}

	public void initCampaign() {
		Companies.initCompanies(); // initialize all the companies info but the
									// info itself
		Resources r = getResources();
		Companies.setCompanyInfo("Free Inc.",
				r.getString(R.string.free_inc_info));
		Companies.setCompanyInfo("Earth Microsystems",
				r.getString(R.string.earth_microsystems_info));
		Companies.setCompanyInfo("Noxxe Mobil",
				r.getString(R.string.noxxe_mobile_info));
		Companies.setCompanyInfo("Nanosoft",
				r.getString(R.string.nanosoft_info));
		Companies.setCompanyInfo("Waterworks",
				r.getString(R.string.waterworks_info));
		
		Objective obj = new MoneyObjective("Get $8,300 in cash to pay off your debts" + "\n" +
		"Cash value is your current funds / uninvested money." + "\n" +
				"To complete an objective, you need to go to the Objective page and tap on the current active objective.",
				Objective.MONEY_OBJECTIVE, 8300);
		CurrentUser.objectiveList.add(obj);
		obj = new MoneyObjective("Get $20,000 in cash to improve food",
				Objective.MONEY_OBJECTIVE, 20000);
		CurrentUser.objectiveList.add(obj);
		obj = new MoneyObjective("Get $50,000 in cash to renovate your hotel",
				Objective.MONEY_OBJECTIVE, 50000);
		CurrentUser.objectiveList.add(obj);
		obj = new TimeObjective("Survive for 1 year. Do not let your total assets go below 0",
				Objective.TIME_OBJECTIVE, 1, 2013);
		CurrentUser.objectiveList.add(obj);
		obj = new MoneyObjective("Get $100000 in cash to add a ballroom in the hotel",
				Objective.MONEY_OBJECTIVE, 100000);
		CurrentUser.objectiveList.add(obj);
		obj = new MoneyObjective("Get $150000 in cash to add a swimming pool",
				Objective.MONEY_OBJECTIVE, 150000);
		CurrentUser.objectiveList.add(obj);
		obj = new MoneyObjective("Get $500000 in cash to add a spa / gym",
				Objective.MONEY_OBJECTIVE, 500000);
		CurrentUser.objectiveList.add(obj);
		
		CurrentUser.currentObj = CurrentUser.objectiveList.get(0);
	}
}
